<template>
  <div class="list"> 
    <div class="personal_content">
      <ul>
        <li v-for="(value,index) in drawData" @click="goLuckDrawDetails(value.id)">
          <div class="conten_header">
            <img :src="value.img_url" class="content_img" mode="aspectFill" data-url="value.link_url"/>
            <!-- <div class="content_sponsor"> -->
               <!-- <img :src="value.title_url" mode="aspectFill" /> -->
            <!-- </div> -->
            <div class="content_time" v-if="'cutPrice' == activeType.type">
                砍价倒计时: {{value.time}}
            </div>
          </div>
          <div class="content_bottom">
            <div class="content_class">{{'cutPrice' == activeType.type?value.school_name:value.title}}</div>
            <div class="content_details">
              <img :src="activeType.join.joinImg" class="details_img" v-if="value.status_type=='join'"/>
              <img :src="activeType.end.endImg" class="details_img" v-else-if="value.status_type=='end'"/>
              <img :src="activeType.start.startImg" class="details_img" v-else/>
              <span  class="details_tip details_green" v-if="value.status_type=='join'">{{activeType.join.joinDesc}}</span>
              <span class="details_tip details_red" v-else-if="value.status_type=='end'">{{activeType.end.endDesc}}</span>
              <span  class="details_tip" v-else>{{activeType.start.startDesc}}</span>
              <span class="details_money" v-if="'cutPrice' == activeType.type">已经砍 {{value.cut_price_count}} 元</span>
              <span class="details_money" v-else>到达 {{value.prize_num}} 人参与自动开奖</span>
            </div>
          </div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  props:['drawData','activeType'],
  data () {
    return {
      arr:[]
    }
  },
  mounted(){
    // console.log(this.redClass)

  },
  computed:{
    dataTime(){
      if('cutPrice' == this.activeType.type){
          this.drawData.forEach((item,index) =>{
            if(item.last_time_int!=undefined){
              this.arr.unshift(item.last_time_int)
              if(item.last_time_int.toString().indexOf('秒')==-1){
                // item.last_time_int=this.$currency.formatSeconds(item.last_time_int)
                this.drawData[index].time=this.$currency.formatSeconds(item.last_time_int)
              }
            }
        })
      }
    }
  },
  methods:{
    goLuckDrawDetails(id){
      if(this.activeType.type=='cutPrice'){
        console.log('a')
        wx.navigateTo({
        url:'../cutPrice/main?id='+id
       })
      }else{
        wx.navigateTo({
          url:'../luckDraw/main?id='+id
        })
      }
    }
  }
}
</script>

<style scoped>
.personal_content{width: 100%;margin-bottom: 30px;}
.personal_content li{margin-bottom: 30px;}
.conten_header{width: 100%;height:187.5px;position: relative;}
.content_img{width: 100%;height: 100%;}
.content_sponsor{width: 92.5px;height: 24px;background-color: rgba(51,51,51,0.3);color: #fff;position: absolute;right: 11px;top:11px;text-align: center;line-height: 24px;font-size: 10px;}
.content_sponsor img{width: 100%;height: 100%;}
.content_time{width: 98%;height: 36.5px;position: absolute;left: 0;bottom: 0;color: #fff;direction: rtl;font-size: 14px;background-color: rgba(51,51,51,0.5);line-height: 36.5px;padding-right: 2%;}
.content_bottom{width: 96%;padding: 15px 2%;}
.content_class{width: 100%;height: 18px;font-size: 15px;}
.content_details{width: 100%;height: 14px;font-size: 12px;line-height: 14px;display: flex;justify-content: row;margin-top:15px;}
.details_red{color: red;}
.details_green{color: #09A110;}
.details_img{width: 14px;height: 14px;display: block;margin-right: 5px;}
.details_tip{height: 14px;line-height: 14px;margin-left: 5px;}
.details_money{height: 14px;line-height: 14px;margin-left: 5px;color: #999999;}
.details_money span{color: #FE2D54;}
.personal_content li{border-bottom: 0.5px solid #cccccc;}
</style>